package solved;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;

/*
ID:		liluyan1
LANG:	JAVA
TASK:	contact
*/
public class contact {
	public static void main(String[] args) throws IOException {
		BufferedReader f = new BufferedReader(new FileReader("contact.in"));
		PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(
				"contact.out")));
		new contact().solve(f, out);
		out.close();
		System.exit(0);
	}
	
	private HashMap<String, Integer> map;
	
	private void solve(BufferedReader f, PrintWriter out) throws IOException {
		int[] a = read(f, 3);
		int A = a[0];
		int B = a[1];
		int N = a[2];
		
		StringBuilder sb = new StringBuilder();
		String line;
		while ((line = f.readLine())!=null) {
			sb.append(line);
		}
		
		map = new HashMap<String, Integer>();
		int L = sb.length();
		for (int i=A; i<=B; i++) {
			for (int j=0; j<=L-i; j++) {
				String key = sb.substring(j, j+i);
				if (map.containsKey(key)) {
					map.put(key, map.get(key)+1);
				}
				else {
					map.put(key, 1);
				}
			}
		}
		
		ArrayList<String> keys = new ArrayList<String>();
		keys.addAll(map.keySet());
		Collections.sort(keys, new Comparator<String>(){
			public int compare(String a, String b) {
				if (map.get(a).intValue() != map.get(b).intValue()) return map.get(b) - map.get(a);
				if (a.length() != b.length()) return a.length() - b.length();
				return Integer.parseInt(a, 2) - Integer.parseInt(b, 2);
			}
		});
		
		ArrayList[] lists = new ArrayList[N];
		for (int i=0, j=0; i<N; i++) {
			if (j >= keys.size()) break;
			int l = map.get(keys.get(j));
			lists[i] = new ArrayList<String>();
			while (j<keys.size() && map.get(keys.get(j))==l) {
				lists[i].add(keys.get(j));
				j++;
			}
		}
		
		for (int i=0; i<N && lists[i]!=null; i++) {
			out.print(map.get(lists[i].get(0)));
			for (int j=0; j<lists[i].size(); j++) {
				out.print((j%6==0? "\n" : " ") + lists[i].get(j));
			}
			out.println();
		}
	}
	
	public int read(BufferedReader f) throws IOException {
		return Integer.parseInt(f.readLine());
	}
	
	public int[] read(BufferedReader f, int N) throws IOException {
		String[] t = f.readLine().split(" ");
		int[] a = new int[N];
		for (int i=0; i<N; i++) {
			a[i] = Integer.parseInt(t[i]);
		}
		return a;
	}
}
